home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / VideoToolboxSources / Zoom.c < prev   
Encoding:
C/C++ Source or Header  |  1993-02-27  |  1.5 KB  |  47 lines  |  [TEXT/KAHL]

  1. /*
  2. Zoom.c 
  3. 10/17/90    dgp    translated from pascal DoWZoom.p in Inside Mac VI.
  4. 10/18/90 dgp    removed part of the code to make GetWindowDevice(), which I put
  5.                 in GetScreenDevice.c
  6. 8/24/91    dgp        Made compatible with THINK C 5.0.
  7. 12/27/91 dgp    Extracted code to create TitleBarHeight.c
  8. 3/26/92    dgp        Replaced use of SysEnvirons() by a call to QD8Exists().
  9. */
  10. #include "VideoToolbox.h"
  11. #if THINK_C
  12.     #include <LoMem.h>
  13. #else
  14.     short MBarHeight : 0xBAA;
  15. #endif
  16.  
  17. void Zoom(WindowPtr theWindow, int zoomDir)
  18. {
  19.     Rect r;
  20.     GDHandle dominantGDevice;
  21.     int headRoom;
  22.     GrafPtr savePort;
  23.     extern EventRecord theEvent;    /* global from main program */
  24.     
  25.     if(TrackBox(theWindow,theEvent.where,zoomDir)){
  26.         GetPort(&savePort);
  27.         SetPort(theWindow);
  28.         EraseRect(&theWindow->portRect);        /*recommended for cosmetic reasons*/
  29.         /* If there is the possibility of multiple gDevices, then we */
  30.         /* must check them to make sure we are zooming onto the right */
  31.         /* display device when zooming out. */
  32.         if(zoomDir==inZoomOut && QD8Exists()){
  33.             headRoom=TitleBarHeight(theWindow);
  34.             /* We must create a zoom rectangle manually in this case. */
  35.             /* Account for menu bar height as well, if on main device */
  36.             dominantGDevice=GetWindowDevice(theWindow);
  37.             if(dominantGDevice==GetMainDevice()) headRoom += MBarHeight;
  38.             r=(*dominantGDevice)->gdRect;
  39.             SetRect(&r,r.left+3,r.top+headRoom+3,r.right-3,r.bottom-3);
  40.             /* Set up the WStateData record for this window. */
  41.             (*((WStateData **)((WindowPeek)theWindow)->dataHandle))->stdState = r;
  42.         }
  43.         ZoomWindow(theWindow,zoomDir,TRUE);
  44.         SetPort(savePort);
  45.     }
  46. }
  47.